package CopaServer;

import Model.Entidades.Clientes;
import Model.dao.ClientesDAO;
import java.util.Collection;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

@Stateless
public class ClienteBean {
    @PersistenceContext(unitName="ClienteEJBPU") //Compra Persistence Unit
    private EntityManager em;
    public Clientes salvar(Clientes c) throws Exception{
        ClientesDAO dao = new ClientesDAO(this.em);
        return dao.salvar(c);
    }
        public Clientes buscaPorId(Integer id){
        ClientesDAO dao = new ClientesDAO(this.em);
        return dao.buscaPorId(id);
    }
        public Collection<Clientes> buscaTodosCompras(){
        ClientesDAO dao = new ClientesDAO(this.em);
        Collection<Clientes> c = dao.buscaTodosClientes();
        return c;      
    }
    
        public void remover(Integer id){
        ClientesDAO dao = new ClientesDAO(this.em);
        dao.remover(id);
    }
}
